#include "addtraindialog.h"
#include "ui_addtraindialog.h"

#include "trainmanagement.h"

AddTrainDialog::AddTrainDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AddTrainDialog)
{
    ui->setupUi(this);
}

AddTrainDialog::~AddTrainDialog()
{
    delete ui;
}

void AddTrainDialog::on_buttonBox_accepted()
{
    QString trainNum = ui->lineEdit->text();

    if(trainNum.isNull() || trainNum.isEmpty())
        return;

    TrainManagement::addTrain(trainNum);
}
